package com.design.备忘录模式;

public class TestMain {

	public static void main(String[] args) {
		
		Originator originator = new Originator();
		CareTaker car = new CareTaker();
		
		originator.setState("S1");
		
		car.add(originator.saveSateToMemento());
		originator.setState("S2");
		car.add(originator.saveSateToMemento());
		
		originator.setState("S3");
		car.add(originator.saveSateToMemento());
		
		originator.setState("S4");
		
		System.out.println("Current State "+originator.getState());
		originator.setStateFromMemento(car.get(0));
        System.out.println("First saved State: " + originator.getState());
        originator.setStateFromMemento(car.get(1));
        System.out.println("Second saved State: " + originator.getState()); 
		
        car.printMementosLength();
	}
	
	
}
